namespace ConcurrentBoo

import System

class ComputationChannel:
	
	private final _channel = Channel()
	
	def Send(e as Expression):
	"""
	Asynchronously sends an expression for evaluation. The resulting value
	can be received with Receive.
	"""
		queueUserWorkItem() do:
			_channel.Put(compute(e))
		
	def Receive() as Computation:
	"""
	Receives the resulting value of an Expression sent for evaluation
	with Send blocking until one is available.
	"""
		return _channel.Take()

